import type { ApiPagination, ApiPaginationParams } from '#types/utils'
import { requestClient } from '../request'
import type { tasktagItemForm, tasktagPageListItem } from './model/tasktagModel'

// 渠道管理
export default class TasktagApi {
    static get inst() {
        return TasktagApi._inst || (TasktagApi._inst = new TasktagApi())
    }
    private static _inst: TasktagApi
    add(params: Partial<tasktagItemForm>) {
        return requestClient.post<null>('/label/add', params)
    }
    delete(ids: Array<number | string>) {
        return requestClient.delete<null>(`/label/delete/${ids}`)
    }
    deleteRef(params: Partial<tasktagItemForm>) {
        return requestClient.post<null>('/label/deleteRef', params)
    }
    edit(id: number | string, params: Partial<tasktagItemForm>) {
        return requestClient.put<null>(`/label/edit/${id}`, params)
    }
    /**
     * 站点管理分页
     * @param params
     */
    getPageList(params: ApiPaginationParams<{ username?: string }>) {
        return requestClient.get<ApiPagination<tasktagPageListItem>>('/label/index', {
            params
        })
    }
}
